home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_02_09
/
2n09017a
< prev
next >
Wrap
Text File
|
1991-07-29
|
1KB
|
48 lines
TAG_IT PROCEDURE(PTR)
! IF RECORD IDENTIFIED BY 'PTR' IS IN TAG TABLE, REMOVE IT.
! OTHERWISE, ADD IT
PTR LONG
CODE
LOOP X# = 1 TO RECORDS(TAG_TABLE)!IS THIS RECORD TAGGED?
GET(TAG_TABLE,X#)
IF (TAG:POINTER = PTR)
DELETE(TAG_TABLE) !YES - UNTAG IT
IF (ERROR()) THEN STOP('Tag Table: ' & ERROR()).
RETURN !AND RETURN
. .
TAG:POINTER = PTR !RECORD IS NOT TAGGED
ADD(TAG_TABLE) !SO TAG IT
IF (ERROR()) THEN STOP('Tag Table: ' & ERROR()).
IS_TAG FUNCTION(PTR)
! IS RECORD IDENTIFIED BY 'PTR' IN TAG TABLE?
PTR LONG
CODE
IF TAG_ALL_FLG THEN RETURN(TRUE).!YES - ALL RECORDS TAGGED
LOOP X# = 1 TO RECORDS(TAG_TABLE)!SEE IF RECORD IS TAGGED
GET(TAG_TABLE,X#)
IF (ERROR()) THEN STOP('Tag Table : ' & ERROR()).
IF (TAG:POINTER = PTR) THEN RETURN(TRUE).!RECORD IS TAGGED
.
RETURN(FALSE) !RECORD IS NOT TAGGED
CLEAR_TAGS PROCEDURE()
! CLEAR ALL TAGGED RECORDS
CODE
TAG_ALL_FLG = FALSE !RESET FLAG
FREE(TAG_TABLE) !DEALLOCATE MEMORY TABLE
ANY_TAGS FUNCTION()
! ARE ANY RECORDS TAGGED?
CODE
IF TAG_ALL_FLG OR RECORDS(TAG_TABLE) THEN RETURN(TRUE). !YES
RETURN(FALSE) !NO
TAG_ALL PROCEDURE()
! TAG ALL RECORDS
CODE
TAG_ALL_FLG = TRUE !SET FLAG